<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>我参与的活动</title>
    <link rel="stylesheet" type="text/css" href="/plugins/vali/css/main.css">
    <link rel="stylesheet" type="text/css" href="/plugins/toast/jquery.toast.css">
    <link rel="stylesheet" type="text/css" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
</head>
<body class="app sidebar-mini">
    <!-- 头部 -->
    <header class="app-header">
        <a class="app-header__logo" href="/user/dashboard">用户中心</a>
        <a class="app-sidebar__toggle" href="#" data-toggle="sidebar" aria-label="Hide Sidebar"></a>
        <ul class="app-nav">
            <li class="dropdown">
                <a class="app-nav__item" href="#" data-toggle="dropdown" aria-label="Open Profile Menu">
                    <i class="fa fa-user fa-lg"></i>
                </a>
                <ul class="dropdown-menu settings-menu dropdown-menu-right">
                    <li><a class="dropdown-item" href="/user/profile"><i class="fa fa-user fa-lg"></i> 个人资料</a></li>
                    <li><a class="dropdown-item" href="/user/logout"><i class="fa fa-sign-out fa-lg"></i> 退出登录</a></li>
                </ul>
            </li>
        </ul>
    </header>
    
    <!-- 侧边栏 -->
    <div class="app-sidebar__overlay" data-toggle="sidebar"></div>
    <aside class="app-sidebar">
        <div class="app-sidebar__user">
            <img class="app-sidebar__user-avatar" 
                 th:src="${session.user_session.userPortrait == null ? '/static/img/portrait.jpg' : session.user_session.userPortrait}" 
                 alt="User Image" width="48px" height="48px">
            <div>
                <p class="app-sidebar__user-name" th:text="${session.user_session.userDisplayName}"></p>
                <p class="app-sidebar__user-designation">博客用户</p>
            </div>
        </div>
        <ul class="app-menu">
            <li>
                <a class="app-menu__item" href="/user/dashboard">
                    <i class="app-menu__icon fa fa-dashboard"></i>
                    <span class="app-menu__label">仪表板</span>
                </a>
            </li>
            <li>
                <a class="app-menu__item" href="/user/articles">
                    <i class="app-menu__icon fa fa-file-text"></i>
                    <span class="app-menu__label">文章管理</span>
                </a>
            </li>
            <li>
                <a class="app-menu__item active" href="/user/my-activities">
                    <i class="app-menu__icon fa fa-calendar"></i>
                    <span class="app-menu__label">我参与的活动</span>
                </a>
            </li>
            <li>
                <a class="app-menu__item" href="/user/profile">
                    <i class="app-menu__icon fa fa-user"></i>
                    <span class="app-menu__label">个人资料</span>
                </a>
            </li>
            <li>
                <a class="app-menu__item" href="/" target="_blank">
                    <i class="app-menu__icon fa fa-home"></i>
                    <span class="app-menu__label">返回主页</span>
                </a>
            </li>
        </ul>
    </aside>
    
    <!-- 主内容区 -->
    <main class="app-content">
        <div class="app-title">
            <div>
                <h1><i class="fa fa-calendar"></i> 我参与的活动</h1>
                <p>查看和管理您参与的所有活动</p>
            </div>
            <ul class="app-breadcrumb breadcrumb">
                <li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i></li>
                <li class="breadcrumb-item"><a href="#">我参与的活动</a></li>
            </ul>
        </div>
        
        <div class="row">
            <div class="col-md-12">
                <div class="tile">
                    <div class="tile-body">
                        <div class="row">
                            <div class="col-12" th:if="${activities.isEmpty()}">
                                <div class="empty-message">
                                    <div class="empty-icon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                                    <p>您还没有参与任何活动</p>
                                    <a href="/activities" class="btn btn-primary btn-sm">查看所有活动</a>
                                </div>
                            </div>
                            
                            <div class="col-md-6 col-lg-4 mb-4" th:each="activity : ${activities}">
                                <div class="activity-card">
                                    <div class="activity-cover">
                                        <img th:src="${activity.coverImage != null ? activity.coverImage : '/static/img/pinghsu.jpg'}" alt="活动封面">
                                    </div>
                                    <div class="activity-info">
                                        <h5 class="activity-title" th:text="${activity.activityName}"></h5>
                                        <div class="activity-meta">
                                            <div class="meta-item">
                                                <i class="fa fa-calendar"></i>
                                                <span th:text="${#dates.format(activity.startTime, 'yyyy-MM-dd HH:mm')}"></span>
                                            </div>
                                            <div class="meta-item" th:if="${activity.activityAddress != null}">
                                                <i class="fa fa-map-marker"></i>
                                                <span th:text="${activity.activityAddress}"></span>
                                            </div>
                                        </div>
                                        <a th:href="@{'/activities/' + ${activity.activityId}}" class="btn btn-block btn-outline-primary btn-sm">查看详情</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
    
    <!-- 脚本 -->
    <script src="/plugins/vali/js/jquery-3.2.1.min.js"></script>
    <script src="/plugins/vali/js/popper.min.js"></script>
    <script src="/plugins/vali/js/bootstrap.min.js"></script>
    <script src="/plugins/vali/js/main.js"></script>
    <script src="/plugins/toast/jquery.toast.js"></script>
    <script src="/js/mayday.js"></script>
    
    <style>
    .empty-message {
        text-align: center;
        padding: 50px 0;
    }
    .empty-icon {
        font-size: 48px;
        color: #ddd;
        margin-bottom: 15px;
    }
    .empty-message p {
        color: #888;
        margin-bottom: 20px;
    }
    .activity-card {
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        height: 100%;
        display: flex;
        flex-direction: column;
        transition: transform 0.3s ease;
    }
    .activity-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    .activity-cover {
        height: 140px;
        overflow: hidden;
    }
    .activity-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.5s ease;
    }
    .activity-card:hover .activity-cover img {
        transform: scale(1.05);
    }
    .activity-info {
        padding: 15px;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }
    .activity-title {
        margin-bottom: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .activity-meta {
        color: #888;
        font-size: 13px;
        margin-bottom: 15px;
        flex-grow: 1;
    }
    .meta-item {
        margin-bottom: 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .meta-item i {
        margin-right: 5px;
        width: 14px;
        text-align: center;
    }
    </style>
</body>
</html>
